<?php
/**
 * Pertyler
 * Object Browser's Group's Objects Page
 *
 * @author	Emre Hasegeli <hasegeli@gmail.com>
 * @license	GNU General Public License v3
 */

namespace Pertyler;

require_once 'main.php';

if((empty($page->ParentTable)) OR (empty($page->Row)) OR (empty($page->Column)))
	die;

$parentTable = Pertyler_Table::Select($page->ParentTable);

$row = $parentTable->SelectRow($page->Row);

$columnArray = $row->SelectGroupColumnArray();

$column = $columnArray[$page->Column];

$treeView = new \KoolTreeView('treeView');

$treeView->imageFolder = $iconsFolder;

$treeView->showLines = true;

foreach($row->SelectGroupRowArray($column) AS $row)
{
	$link = new Link('ObjectBrowser.php', 'body');

	$link->ParentTable = $parentTable->id();

	$link->Row = $row->id();

	$treeView->Add('root',
			$column->backgroundName() . $row->id(),
			$link->Html($row),
			false,
			'page.gif');
}

$treeView->isSubTree = true;

$treeView->width = '250px';

echo $treeView->Render();